{% extends "house/base.html" %}
{% block title %}{% endblock %}
{% block content_title %}{% endblock %}

{% block sub_menu %}
<li><a href="{% url current_month %}">Текущий месяц</a></li>
{% endblock %} 

{% block mainmenuitem_2 %}class="mainMenuSelectedItem"{% endblock %}

{% block main %}


<h2>Журнал учета расходов {{processed_month_verbose}} {{processed_year}} г.</h2>
<table class="table_layout">
<tr><td class="td_layout">
<h4 class="form_title">Приход</h4>
<form method="post" action="{% url new_arrival %}" name="arrival_form">
    <div>
        <fieldset class="aligned">
        {% for field in arrival_form %}
            <div class="form-row">
                {{ field.errors }}
                <div>
                    {{ field.label_tag }}
                    {{ field }}&nbsp;&nbsp;{% if field.field.required %}<font color="red">*</font>{% endif %}
                </div>
            </div>
        {% endfor %}
        </fieldset>
        <div>
            <input class="default" type="submit" name="_save" value="Сохранить"/>
        </div>
    </div>
</form>
</td><td class="td_layout">
<h4 class="form_title">Расход</h4>
<form method="post" action="{% url new_expense %}" name="expense_form">  
    <div>
        <fieldset class="aligned">
        {% for field in expense_form %}
            <div class="form-row">
                {{ field.errors }}
                <div>
                    {{ field.label_tag }}
                    {{ field }}&nbsp;&nbsp;{% if field.field.required %}<font color="red">*</font>{% endif %}
                </div>
            </div>
        {% endfor %}
        </fieldset>
        <div>
            <input class="default" type="submit" name="_save" value="Сохранить"/>
        </div>
    </div>
</form>
</td></tr>
</table>

<div class="floats">
<table>
  <tr>
    <th width="12%">Дата</th>
    <th width="10%">Период</th>
    <th width="10%">Приход</th>
    <th width="1%"></th>
    <th width="48%">Наименование</th>
    <th width="3%">Кол-во</th>
    <th width="8%">Цена</th>
    <th width="8%">Сумма</th>
    <th></th>
  </tr>
  {% for op in operation_list %}
  <tr>
    <td>{{ op.data|date:"d.m.Y" }}</td>
    <td>{{ op.period_month }}.{{ op.period_year }}</td>
    {% if op.kind == 'A' %}
      <td><nobr>{{ op.amount|cut:"-" }} р.</nobr></td>
    {% else %}    
      <td class="td_empty"></td>   
    {% endif %}
    <td>
      {% if op.kind == 'A' %}
        <img src="{% load media %}{% media_prefix %}img/house-in.gif" width="14" height="14" alt="">
      {% else %}
        <img src="{% media_prefix %}img/house-out.gif" width="14" height="14" alt="">
      {% endif %}
    </td>
    <td>{{ op.name }}</td>
    {% if op.kind == 'E' %}
    <td>{{ op.quantity }}</td>
    <td><nobr>{{ op.price }} р.</nobr></td>
    <td><nobr>{{ op.amount|cut:"-" }} р.</nobr></td>
    {% else %}
    <td class="td_empty"></td>
    <td class="td_empty"></td>
    <td class="td_empty"></td>
    {% endif %}
    <td>
    <a href="{% url delete_operation op.id %}"  title="Удалить запись"
          OnClick="return confDeleteOperation({{ op.id }}, '{{ op.data|date:'d.m.Y' }}');">
          <img src="{% media_prefix %}img/house-abort-a.gif" width="14" height="14">
          </a>
    
    </td>
  </tr>   
  {% endfor %} 
</table>
   
</div>

{% endblock %}
